<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@include file="../base.jsp" %>
<sys:genericTag4o
		methodName="queryCategory1All"
		className="com.tmpt.controller.taglib.CategoryTag"
		id="categoryDtoList"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>	
<link href="../css/main.css" rel="stylesheet" type="text/css" >
<script type="text/javascript" src="../../js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../../js/jquery.select.js"></script>
<script type="text/javascript" src="js/productAdd.js"></script>
<link href="../css/table.css" rel="stylesheet" type="text/css" >
<link rel="stylesheet" type="text/css" href="${path}/js/jquery/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${path}/js/jquery/easyui/themes/icon.css">
<script src="${path}/js/jquery/easyui/jquery-1.8.0.min.js"></script>
<script src="${path}/js/jquery/easyui/jquery.easyui.min.js"></script>
</head>
<body class="font14">
	<table width="100%">
		<tr>
			<td valign="top"  width="200px">
				<%@include file="productAddStep1.jsp" %>
				<script type="text/javascript">
					$(function(){
						$("#productAddStep_1>a").css("color","red");
					});
					$("#productAddStep_1>a").css("color","red");
				</script>
			</td>
			<td valign="top"  width="600px">
				<s:if test="#attr.result!=null">
					<table class="table1" width="100%" cellpadding="0" cellspacing="0" >
						<thead>
							<tr style="background-color: #DEE9FB; color: #15428B;">
								<td align="center">
									<strong>操作结果</strong>
								</td>
							</tr>
						</thead>
						<tr>
							<td><font color="red"><s:property value="#attr.result"/></font>	</td>
						</tr>
					</table>
					<br/>
				</s:if>
				<s:form name = "formProductBasic" id="formProductBasic" action="product_addBasic.action" method="post" namespace="/admin123/product" theme="simple">
				<table class="table1" align="center" width="100%" cellpadding="0" cellspacing="0">
					<thead>
						<tr style="background-color: #DEE9FB; color: #15428B;">
							<td colspan="2" align="center">
								<strong>商品基本信息管理</strong>
								<input type="hidden" name="productId" id="productId" value="${productId}">
							</td>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>一级类别:</td>
							<td>
								<s:select list="%{#attr.categoryDtoList}"
										  listKey="id"
										  listValue="categoryName"
										  headerKey=""
										  headerValue="=请选择="
										  theme="simple"
										  name="category1Id"
										  id="category1Select"
								/>
							</td>
						</tr>
						<tr>
							<td>二级类别:</td>
							<td>
								<c:if test="${1 == 1}">
									<select
											id="category2Select"
											name="category2Id"
											style="width: 160px;"
											onchange="javascript:queryCategory3ByCategory2();"
									>
										<option value="0">=请选择=</option>
									</select>
								</c:if>
								<c:if test="${1 != 1}">
									<s:select
											list="%{#attr.productBasicDto.category2Id:#attr.productBasicDto.category2Name}"
											headerKey="0"
											headerValue="=请选择="
											id="category2Select"
											name="category2Id"
											cssStyle="width:160px;"
											onchange="javascript:queryCategory3ByCategory2();"
											value="%{#attr.productBasicDto.category2Id}"
									/>
								</c:if>
							</td>
						</tr>
						<tr>
							<td>三级类别:</td>
							<td>
								<c:if test="${1 == 1}">
									<select
											id="category3Select"
											name="category3Id"
											style="width: 160px;"
											onchange="javascript:queryPropertyTypeByCategory3();"
									>
										<option value="0">=请选择=</option>
									</select>
								</c:if>
								<c:if test="${1 != 1}">
									<s:select
											list="%{#attr.productBasicDto.category3Id:#attr.productBasicDto.category3Name}"
											headerKey="0"
											headerValue="=请选择="
											id="category3Select"
											name="category3Id"
											cssStyle="width:160px;"
											onchange="javascript:queryPropertyTypeByCategory3();"
											value="%{#attr.productBasicDto.category3Id}"
									/>
								</c:if>
							</td>
						</tr>
						<tr>
							<td>商品名称:</td>
							<td>
								<s:textfield
									name="goodsName"
									id="goodsName"
									value="%{#attr.goodsInfoDto.goodsName}"
									theme="simple" size="70" maxlength="100"
									cssClass="easyui-validatebox"
									data-options="required:true"/>
							</td>
						</tr>
						<tr>
							<td>单位:</td>
							<td>
								<s:select
										name="unit"
										list="#{0:'件数',1:'公斤'}"
										theme="simple"
										value="%{#attr.goodsInfoDto.unit}"/>
							</td>
						</tr>
						<tr>
							<td>单价:</td>
							<td>
								<s:textfield name="goodsPrice"
								value="%{#attr.goodsInfoDto.goodsPrice}"
								theme="simple"
								cssClass="easyui-numberbox"
                                data-options="required:true"
                                min="0"
                                max="99999999999999"
                                precision="2"
                                invalidMessage="单位'元',如100、 95.5、 95.55等"
								/>
							</td>
						</tr>
						<tr>
							<td>入库数量:</td>
							<td>
								<input type="text" id="stacknum" name="stacknum" value=""/>
							</td>
						</tr>
						<tr>
							<td>选择仓库:</td>mchntId
							<td>
								<select
										id="goodsStackid"
										style="width: 160px;"
										size="15"
										onchange="javascript:queryCategory2ByCategory1();"
								/>
							</td>
						</tr>
						<tr>
							<td>状态:</td>
							<td>
								<s:select
									name="status"
									list="#{1:'上架',0:'下架'}"
									theme="simple"
									value="%{#attr.productBasicDto.status}"/>
							</td>
						</tr>
					</tbody>
					<tfoot style="border-top: 1px solid #DEE9FB;">
						<tr>
							<td colspan="2" align="center" style="border-top: 1px solid #DEE9FB;">
								<input type="button" id="addProductBtn" value="添加" onclick="javascript:addProductBasic();">
								&nbsp;&nbsp;
								<input type="button" id="editProductBtn" value="编辑" onclick="javascript:editProductBasic();">
								<script type="text/javascript">
								function editProductBasic(){
									if(!$('#formProductBasic').form('validate')){
									    alert('数据填写不完整');
									    return;
									  }
									//控制按钮为可用
 									//$("#editProductBtn").removeAttr("disabled");
								    $('#editProductBtn').val('处理中..');
							        $("#editProductBtn").attr({"disabled":"disabled"});

									$('#formProductBasic').attr('action','product!editProductBasic.action');
									$('#formProductBasic').submit();
								}
							    function addProductBasic(){
                                    if(!$('#formProductBasic').form('validate')){
                                        alert('数据填写不完整');
                                        return;
                                      }

								    $('#addProductBtn').val('处理中..');
							        $("#addProductBtn").attr({"disabled":"disabled"});
                                    $('#formProductBasic').submit();
                                }

								</script>
							</td>
						</tr>
					</tfoot>
				</table>
				</s:form>
			</td>
			<td valign="top" >
				<!-- test user param; real user: attr -->
				<jsp:include page="productInfo.jsp">
					<jsp:param name="productId" value="${attr.productId}"/>
				</jsp:include>
			</td>
		</tr>
	</table>


</body>
</html>